package com.example.aboutspringboot.controller;

import com.example.aboutspringboot.entity.Admin;
import com.example.aboutspringboot.service.AdminService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.LinkedHashMap;
import java.util.Map;

@RestController
@RequestMapping("admin")
@CrossOrigin//跨域
public class AdminController {

    @Resource
    private AdminService adminService;

    @PostMapping("/login")
    public Map<String,Object> adminLogin(@RequestBody Admin admin){
        Map<String,Object> map=new LinkedHashMap<>();
        Admin user= adminService.selectAdmin(admin);
        if (user!=null){
            map.put("result",true);
        }else {
            map.put("result",false);
        }
        return map;
    }

}
